package com.farm.common.dto;

import com.farm.common.entity.BaseEntity;
import com.farm.common.util.BeanUtils;
import org.springframework.lang.NonNull;

/**
 * IBaseDTO
 *
 * @author ctidy
 * @since 2021/1/7
 */
public interface IBaseDTO<T extends BaseEntity> {

    default <U extends IBaseDTO<?>> U fromEntity(@NonNull T entity) {
        BeanUtils.updateProperties(entity, this);
        return (U) this;
    }

}
